package com.announcement.entity;

// Generated 2015-11-3 9:18:49 by Hibernate Tools 4.0.0

import static javax.persistence.GenerationType.IDENTITY;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 * Message generated by hbm2java
 */
@Entity
@Table(name = "message", catalog = "announcement")
public class Message implements java.io.Serializable {

	private Integer messId;
	private User user;
	private String title;
	private String content;
	private boolean published;
	private Date publishDate;

	public Message() {
	}

	public Message(User user, String title, String content, boolean published) {
		this.user = user;
		this.title = title;
		this.content = content;
		this.published = published;
	}

	public Message(User user, String title, String content, boolean published,
			Date publishDate) {
		this.user = user;
		this.title = title;
		this.content = content;
		this.published = published;
		this.publishDate = publishDate;
	}

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "mess_id", unique = true, nullable = false)
	public Integer getMessId() {
		return this.messId;
	}

	public void setMessId(Integer messId) {
		this.messId = messId;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "user_id", nullable = false)
	public User getUser() {
		return this.user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	@Column(name = "content", nullable = false, length = 65535)
	public String getContent() {
		return this.content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	@Column(name = "published", nullable = false)
	public boolean isPublished() {
		return this.published;
	}

	public void setPublished(boolean published) {
		this.published = published;
	}

	@Temporal(TemporalType.DATE)
	@Column(name = "publish_date", length = 10)
	public Date getPublishDate() {
		return this.publishDate;
	}

	public void setPublishDate(Date publishDate) {
		this.publishDate = publishDate;
	}
	@Column(name = "content", nullable = false, length = 200)
	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

}
